package com.zff.controller;


import com.alibaba.fastjson.JSONObject;
import com.zff.dao.XspxPrizeDao;
import com.zff.dao.XstWxUserDao;
import com.zff.entity.XspxPrize;
import com.zff.entity.XstWxUser;
import com.zff.service.XstWxUserService;
import com.zff.tool.WeChatUtil;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.BoundValueOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zff
 * @since 2020-07-31
 */


//@Controller
@CrossOrigin
@RestController
@ApiOperation("微信用户控制器")
@RequestMapping("/xspxPrize")
public class XspxPrizeController {
    @Autowired
    private XspxPrizeDao xspxPrizeDao;


    /**
     * 获取用户获奖信息
     * @param name
     * @return
     */
    @GetMapping("/getPrize")
    public Map getPrize(String name,String type){
        HashMap<String, Object> map = new HashMap<>();
        HashMap<String, Object> map1 = new HashMap<>();
        map1.put("name",name);
        map1.put("type",type);
        List<XspxPrize> xspxPrizes = xspxPrizeDao.selectByMap(map1);
        System.out.println("xspxPrizes:"+xspxPrizes);
        if(xspxPrizes.size()>0){
            map.put("xspxPrizes", xspxPrizes);
            map.put("msg", "success");
            map.put("state", "1");
        } else {
            map.put("msg", "error");
            map.put("state", "0");
        }
        return map;
    }






}

